package com.zmzncs.lmtc.module.promotion.controller;


import com.zmzncs.lmtc.common.pojo.Rest;
import com.zmzncs.lmtc.common.util.JsonUtil;
import com.zmzncs.lmtc.common.util.RestUtil;
import com.zmzncs.lmtc.module.promotion.pojo.month_rule_park.MonthRuleParkDTO;
import com.zmzncs.lmtc.module.promotion.pojo.month_rule_park.MonthRuleParkVO;
import com.zmzncs.lmtc.module.promotion.pojo.reserve_rule_park.ReserveRuleParkDTO;
import com.zmzncs.lmtc.module.promotion.pojo.reserve_rule_park.ReserveRuleParkVO;
import com.zmzncs.lmtc.module.promotion.service.MonthRuleParkService;
import com.zmzncs.lmtc.module.promotion.service.ReserveRuleParkService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 促销-预约规则关联的停车场 前端控制器
 * </p>
 *
 * @author 高博文
 * @since 2020-12-14
 */
@Api(tags = "预约规则适用停车场")
@RestController
@RequestMapping("/promotion/reserve-rule-park")
public class ReserveRuleParkController {

    @Autowired
    ReserveRuleParkService reserveRuleParkService;

    @ApiOperation(value = "查询预约规则的停车场")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "header", name = "token", value = "请求头token", required = true),
            @ApiImplicitParam(paramType="query", name="keyword", value="搜索关键字"),
    })
    @GetMapping(value = "getReserveRuleParkList")
    public Rest<List<ReserveRuleParkVO>> getReserveRuleParkList(String keyword) {
        List<ReserveRuleParkDTO> reserveRuleParkDTOList = reserveRuleParkService.getReserveRuleParkList(keyword);
        List<ReserveRuleParkVO> reserveRuleParkVOList = JsonUtil.listTransform(reserveRuleParkDTOList, ReserveRuleParkVO.class);
        return RestUtil.success(reserveRuleParkVOList);
    }
}

